﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LOMBARDISPICK.Model;

namespace LOMBARDISPICK.Model.Infrastructure
{
	public class UnitOfWork : IUnitOfWork
	{
		private readonly IDatabaseFactory databaseFactory;
		private LombardisPickEntities dataContext;

		public UnitOfWork(IDatabaseFactory databaseFactory)
		{
			this.databaseFactory = databaseFactory;
		}

		protected LombardisPickEntities DataContext
		{
			get { return dataContext ?? (dataContext = databaseFactory.Get()); }
		}

		public void Commit()
		{
			DataContext.Commit();
		}
	}
}